package com.qianxx.base.utils;

/**
 * 获取不为空的数据
 */
public class TypeUtil {

	public static String getValue(String obj) {
		if (obj == null) {
			obj = "";
		}
		return obj;
	}

	public static String getValue(String obj, String defaultValue) {
		if (obj == null) {
			obj = defaultValue;
		}
		return obj;
	}

	public static int getValue(Integer obj) {
		if (obj == null) {
			obj = 0;
		}
		return obj;
	}

	public static int getValue(Integer obj, int defaultValue) {
		if (obj == null) {
			obj = defaultValue;
		}
		return obj;
	}

	public static double getValue(Double obj, double defaultValue) {
		if (obj == null) {
			obj = defaultValue;
		}
		return obj;
	}

	public static float getValue(Float obj, float defaultValue) {
		if (obj == null) {
			obj = defaultValue;
		}
		return obj;
	}

}
